﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace RL
{
    /// <summary>
    /// Логика взаимодействия для ucTime.xaml
    /// </summary>
    public partial class ucTime : UserControl
    {

        

        public string Time
        {
            get
            { 
                return (string)GetValue(TimeProperty);
            }
            set 
            { 
                SetValue(TimeProperty, value);
            }
        }

        // Using a DependencyProperty as the backing store for Time.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TimeProperty = 
            DependencyProperty.Register("Time", typeof(string), typeof(ucTime), new UIPropertyMetadata("", new PropertyChangedCallback(OnTimeChanged)));


        public static void OnTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ucTime obj = d as ucTime;
            if (null == d) return;
            obj.textBox1.Text = (string)e.NewValue;
        }       

        public ucTime()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox tb = sender as TextBox;
            if (null == tb) return;
            SetValue(TimeProperty, tb.Text);
        }
    }
}
